

import 'package:flutter/material.dart';

class UnReadMessageCounter with ChangeNotifier{

  late int unReadCnt=0;
  late int cid=-1;
  late int unreadValue;

  void addUnRead(int cid,int value){
    this.cid=cid;
    unreadValue=value;
    unReadCnt+=value;
    notifyListeners();
  }

  void subUnRead(int cid,int value){
    this.cid=cid;
    unreadValue=-value;
    unReadCnt-=value;
    if(unReadCnt<0) {
      unReadCnt=0;
    }
    notifyListeners();
  }
}